package com.controller;

import com.config.CommonConstant;
import com.entity.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class VersionController extends ApiBasicController {

    /**
     * 当前项目版本
     */
    @RequestMapping(value = "/version", produces = CommonConstant.APPLICATION_JSON_UTF8,method = {RequestMethod.GET,RequestMethod.POST})
    public ApiResponse<Map<String,Object>> getVersion(){
        Map<String,Object> apiVersion = new LinkedHashMap<>();
        apiVersion.put("version",applicationConfig.getVersion());
        apiVersion.put("releaseTime",applicationConfig.getReleaseTime());
        return ApiResponse.ok(apiVersion);
    }

}
